package com.findme.gui;

import com.findme.controller.ControllerUsuario;
import com.findme.findme.R;
import com.findme.model.Usuario;
import com.findme.uteis.testeConeccao;
import com.findme.uteis.alertaDialog;

import android.os.Bundle;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;

public class TelaEsqueceuSenha extends Activity {
	
	
	//ProgressDialog pdl= new ProgressDialog(TelaEsqueceuSenha.this); 

	@Override
	protected void onCreate(Bundle savedInstanceState) {
				
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_tela_esqueceu_senha);		
				
		EditText edtSenha;	
		edtSenha = (EditText) findViewById(R.id.edtEmailEnvio);			
		edtSenha.setText("ti@gmail.com");		
		
	    ImageView  btnEnviarSenha  = (ImageView) findViewById(R.id.imgVwEnviar);	
	    
	    btnEnviarSenha.setOnClickListener( new View.OnClickListener() {
			
			public void onClick(View v) {	
				
	
			
			/*pdl.setTitle(R.string.login_sistema);          
			pdl.setIcon(R.drawable.ic_launcher);
			pdl.setCancelable(false);	
		    pdl = ProgressDialog.show(TelaEsqueceuSenha.this,TelaEsqueceuSenha.this.getString(R.string.app_name),TelaEsqueceuSenha.this.getString(R.string.progressEnvioSenha), false, true);	
			*/	
			  
			  
			  EditText  edtEmail  = (EditText) findViewById(R.id.edtEmailEnvio);	
				
			  Usuario user = new Usuario();
			  user.setEmail(edtEmail.getText().toString());
			  
			  ControllerUsuario ct = new ControllerUsuario(user);
			  
			  if(ct.enviarSenha(TelaEsqueceuSenha.this)){
				  edtEmail.setText("");
			  }

			 
            }
		});
	    		
	}    
	

	
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.tela_esqueceu_senha, menu);
		return true;
	}	

}
